package topin.facecat.FaceCat.UI

import facecat.topin.core.FCColor
import facecat.topin.core.FCPaint
import facecat.topin.core.FCRect
import facecat.topin.grid.FCGridRow
import topin.facecat.FaceCat.UI.MyColor


class GridRowEx : FCGridRow() {
    init {
        height = 25
    }

    override fun onPaint(paint: FCPaint, clipRect: FCRect, isAlternate: Boolean) {
        val grid = grid
        val rows = grid.selectedRows
        val rowsSize = rows.size
        val bounds = bounds
        var scrollH = 0
        var scrollV = 0
        if (grid.hScrollBar != null && grid.hScrollBar.isVisible) {
            scrollH = grid.hScrollBar.pos
        }
        if (grid.vScrollBar != null && grid.vScrollBar.isVisible) {
            scrollV = grid.vScrollBar.pos
        }
        bounds.left = 1
        bounds.top -= scrollV
        bounds.right = bounds.right - bounds.left
        bounds.bottom -= scrollV
        if (rowsSize > 0) {
            if (rows.contains(this)) {
                paint.fillRect(MyColor.USERCOLOR219, bounds)
            } else {
                if (isAlternate) {
                    if (MyColor.m_style == 0) {
                        paint.fillRect(FCColor.rgb(28, 28, 28), bounds)
                    } else {
                        paint.fillRect(FCColor.rgb(240, 240, 240), bounds)
                    }
                }
            }
        }
    }
}